package com.szwistar.common.meta.condition;

import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;

@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = false)
@JsonSubTypes({
        @JsonSubTypes.Type(name = "isNull", value = ConditionIsNull.class),
        @JsonSubTypes.Type(name = "isNotNull", value = ConditionIsNotNull.class),
        @JsonSubTypes.Type(name = "isTrue", value = ConditionIsTrue.class),
        @JsonSubTypes.Type(name = "isFalse", value = ConditionIsFalse.class),
        @JsonSubTypes.Type(name = "eq", value = ConditionEqual.class),
        @JsonSubTypes.Type(name = "ne", value = ConditionNotEqual.class),
        @JsonSubTypes.Type(name = "like", value = ConditionLike.class),
        @JsonSubTypes.Type(name = "gt", value = ConditionGreatThan.class),
        @JsonSubTypes.Type(name = "ge", value = ConditionGreatEqual.class),
        @JsonSubTypes.Type(name = "lt", value = ConditionLittleThan.class),
        @JsonSubTypes.Type(name = "le", value = ConditionLittleEqual.class),
        @JsonSubTypes.Type(name = "between", value = ConditionBetween.class),
        @JsonSubTypes.Type(name = "in", value = ConditionIn.class),
        @JsonSubTypes.Type(name = "notIn", value = ConditionNotIn.class)
})
public abstract class Condition {
    public String type;
    public String field;

    public Condition() { }

    public Condition(String type, String field) {
        this.type = type;
        this.field = field;
    }
}
